package com.drive.controller;

import com.drive.bean.Subject;
import com.drive.constant.MessageConstant;
import com.drive.entity.Result;
import com.drive.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 往
 * 前台页面
 * 科目预约
 */
@RestController
@RequestMapping("/subject")
public class SubjectController {
    @Autowired
    private SubjectService subjectService;

    //获取所有科目信息
    @RequestMapping("/getsubject")
    public Result getSubject(){
        try{
            List<Subject> subjectList = subjectService.findAll();
            return new Result(true, MessageConstant.GET_SUBJECTL_LIST_SUCCESS,subjectList);
        }catch (Exception e){
            return new Result(false,MessageConstant.GET_SUBJECTL_LIST_FAIL);
        }
    }

}
